﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.ShprossesBuilder.Modelling.Components;

namespace ITAP.ShprossesBuilder.Operations
{
    public class OperationRemoveShprossConnectorInnerSnapOnCap : IOperation
    {
        #region IOperation Members

        public string Name
        {
            get { return "Удалить накладку"; }
        }

        public OperationGroup OperationGroup
        {
            get { return OperationGroup.ShprossConnectorOperation; }
        }

        public System.Drawing.Image Thumbnail
        {
            get { return null; }
        }

        public void Execute(ModelControl modelControl)
        {
            foreach(IComponent innerComponent in modelControl.ModelContainer.SelectedComponentsStack)
                if (innerComponent is ShprossConnector)
                {
                    SnapOnCap cap = (innerComponent as ShprossConnector).SnapOnCap;
                    if(cap != null)
                        innerComponent.RemoveInnerComponent(cap);
                }
        }

        public bool CanUndo
        {
            get { return true; }
        }

        #endregion
    }
}
